package org.hhchat.leetcode.math;

import java.util.ArrayList;

public class code507_easy {
    static class Solution {
        public boolean checkPerfectNumber(int num) {
            int sum = getD(num);
            return sum == num;
        }

        public int getD(int num) {
            int sum = 0;
            for (int i = 2; i <= Math.sqrt(num); i++) {
                if (num % i == 0) {
                    sum += i;
                    if (i != num / i) {
                        sum += num / i;
                    }
                }
            }
            return sum + 1;
        }
    }

    static class A{

    }

    static class B extends  A{

    }
    static class C extends B{

    }
    public static void main(String[] args) {
        Solution solution = new Solution();
        ArrayList<? super B> objects = new ArrayList<B>();
        objects.add(new C());
        Long a = new Long(10);
        Long b = new Long(10);
        System.out.println(a==b);
        System.out.println(solution.checkPerfectNumber(28));
    }

}
